<template>
    <Form
            :form-items="formItems"
    ></Form>
</template>

<script>
    import Form from '../../../../../common-util/src/components/page/Form.vue'
    export default {
        components:{
            Form
        },
        data(){
            return {
                formItems:[
                    {
                        field: {
                            name: 'appCode'
                        },
                        element:{
                            type: 'select',
                            select:{
                                url: this.$baseURL.wx + '/wx/mp/config/list',
                                optionProp:{
                                    value: 'appCode',
                                    label: 'appName'
                                }
                            },
                            required: true,
                            label: '公众号',
                        }
                    },
                    {
                        field: {
                            name: 'primaryIndustry'
                        },
                        element:{
                            type: 'select',
                            select:{
                                groupUrl: this.$baseURL.wx + '/wx/mp/tempmsg/industryDict',
                            },
                            label: '主行业',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'secondIndustry'
                        },
                        element:{
                            type: 'select',
                            select:{
                                groupUrl: this.$baseURL.wx + '/wx/mp/tempmsg/industryDict',
                            },
                            label: '副行业',
                            required: true
                        }
                    },
                    {
                        element:{
                            type: 'button',
                            button:[
                                {
                                    action: 'submit',
                                    requestMethod:'post',
                                    url: this.submitUrl,
                                    label: '确认设置'
                                },
                                {
                                    action: 'reset',
                                    label: '重置',
                                    type: 'default'
                                }
                            ]
                        }
                    }
                ]
            }
        },
        methods:{
            submitUrl(form){
                let appCode = form.appCode
                if (!appCode) {
                    return false
                }
                return this.$baseURL.wx + '/wx/mp/tempmsg/' + appCode + '/industry'
            }
        }
    }
</script>

<style scoped>

</style>